package com.ybb.production.service.impl;

import com.ybb.production.domain.GarmentProductionSpec;
import com.ybb.production.mapper.GarmentProductionSpecMapper;
import com.ybb.production.service.IGarmentProductionSpecService;
import com.yubb.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 规格通用Service业务层处理
 *
 * @author dengjie
 * @date 2023-09-06
 */
@Service
public class GarmentProductionSpecServiceImpl implements IGarmentProductionSpecService {
    @Autowired
    private GarmentProductionSpecMapper garmentProductionSpecMapper;

    /**
     * 查询规格通用
     *
     * @param id 规格通用主键
     * @return 规格通用
     */
    @Override
    public GarmentProductionSpec selectGarmentProductionSpecById(Long id) {
        return garmentProductionSpecMapper.selectGarmentProductionSpecById(id);
    }

    /**
     * 查询规格通用列表
     *
     * @param garmentProductionSpec 规格通用
     * @return 规格通用
     */
    @Override
    public List<GarmentProductionSpec> selectGarmentProductionSpecList(GarmentProductionSpec garmentProductionSpec) {
        return garmentProductionSpecMapper.selectGarmentProductionSpecList(garmentProductionSpec);
    }

    /**
     * 新增规格通用
     *
     * @param garmentProductionSpec 规格通用
     * @return 结果
     */
    @Override
    public int insertGarmentProductionSpec(GarmentProductionSpec garmentProductionSpec) {
                garmentProductionSpec.setCreateTime(DateUtils.getNowDate());
            return garmentProductionSpecMapper.insertGarmentProductionSpec(garmentProductionSpec);
    }

    /**
     * 修改规格通用
     *
     * @param garmentProductionSpec 规格通用
     * @return 结果
     */
    @Override
    public int updateGarmentProductionSpec(GarmentProductionSpec garmentProductionSpec) {
                garmentProductionSpec.setUpdateTime(DateUtils.getNowDate());
        return garmentProductionSpecMapper.updateGarmentProductionSpec(garmentProductionSpec);
    }

    /**
     * 批量删除规格通用
     *
     * @param ids 需要删除的规格通用主键
     * @return 结果
     */
    @Override
    public int deleteGarmentProductionSpecByIds(Long[] ids) {
        return garmentProductionSpecMapper.deleteGarmentProductionSpecByIds(ids);
    }

    /**
     * 删除规格通用信息
     *
     * @param id 规格通用主键
     * @return 结果
     */
    @Override
    public int deleteGarmentProductionSpecById(Long id) {
        return garmentProductionSpecMapper.deleteGarmentProductionSpecById(id);
    }
}
